package com.example.lvsuo.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.lvsuo.entity.CaseLaw;
import com.example.lvsuo.entity.CwPerformancesplit;
import com.example.lvsuo.entity.vo.xzhvo.PerformancesplitVo;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.ICwPerformancesplitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/cwPerformancesplit")
public class CwPerformancesplitController {

    @Autowired
    ICwPerformancesplitService cs;

    @PostMapping
    Result addcwPerformancesplit(@RequestBody List<CwPerformancesplit> l){
        cs.addcwPerformancesplit(l);
        return Result.back("成功");
    }

    @GetMapping("")
    Result queryCwPerformancesplit(String id){
        return Result.back(cs.queryCw(id));
    }
    @GetMapping("/id/cwPerformancesplit")
    Result queryCwPerformancesplit(PerformancesplitVo performancesplitVo){
        return Result.back(cs.getidcwPerformancesplit(performancesplitVo));
    }
    @GetMapping("/empidANDcawid")
    Result getCwPerformancesplit(CwPerformancesplit cwPerformancesplit){

  return Result.back( cs.getCwPerformancesplitNADempidandlawid(cwPerformancesplit));
    }

    @DeleteMapping("/{id}")
    Result deCwPerformancesplit(@PathVariable("id") String id){
        cs.remove(new QueryWrapper<CwPerformancesplit>().eq("case_law_id",id));
        return Result.back("成功");
    }
}

